package com.bos.dao.repositories;

import com.bos.domian.system.Permission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author misterWei
 * @create 2018年12月31号:16点08分
 * @mailbox mynameisweiyan@gmail.com
 */
public interface PermsRepository extends JpaRepository<Permission,Integer>{
    @Query("from Permission as p inner join fetch p.roles as r inner join fetch r.users as u where u.id =?1")
    List<Permission> byUserPerms(Integer userId);
}
